package sch.frog.creational.builderpattern.builder;

import sch.frog.creational.builderpattern.product.A.APartOne;
import sch.frog.creational.builderpattern.product.A.APartTwo;
import sch.frog.creational.builderpattern.product.A.AProduct;
import sch.frog.creational.builderpattern.product.IProduct;

public class AProductBuilder implements Builder {

    private APartOne aPartOne;

    private APartTwo aPartTwo;

    private String name;

    private int value;

    @Override
    public void buildPartOne() {
        this.aPartOne = new APartOne();
    }

    @Override
    public void buildPartTwo() {
        this.aPartTwo = new APartTwo(this.aPartOne);
    }

    @Override
    public IProduct build() {
        AProduct product = new AProduct();
        product.setaPartTwo(this.aPartTwo);
        product.setName(this.name);
        product.setValue(this.value);
        return product;
    }

    @Override
    public Builder setName(String name) {
        this.name = name;
        return this;
    }

    @Override
    public Builder setValue(int value) {
        this.value = value;
        return this;
    }
}
